<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Gyroscope Test</title>
</head>

<body>
<table>
    <tr>
        <td>X: </td>
        <td id="X"></td>
    </tr>
    <tr>
        <td>Y: </td>
        <td id="Y"></td>
    </tr>
    <tr>
        <td>Z: </td>
        <td id="Z"></td>
    </tr>
    <tr>
        <td>Meta:</td>
        <td id="M"></td>
    </tr>
    <tr>
        <td>Test</td>
        <td id="T"></td>
    </tr>
</table>
</body>
<script>
    document.getElementById('T').innerHTML = typeof Gyroscope;
    const g = new Gyroscope({frequency: 60});

    g.addEventListener('reading', e => {
        document.getElementById('X').innerHTML = g.x;
        document.getElementById('Y').innerHTML = g.y;
        document.getElementById('Z').innerHTML = g.z;
    });
    g.start();

    document.getElementById('M').innerHTML = JSON.stringify(g);
</script>

</html>